package com.ziytek.web.citizen.model.data;

import lombok.Data;

import java.util.Comparator;
import java.util.List;

/**
 * @author fengh
 */
@Data
public class BatteryDetail {
    /**
     * 分控板地址 1-字节  0xAA
     */
    //private Integer controlBoardAddress;
    private Integer c;

    /**
     * 分控板的电芯数量 1-字节  0xAA
     */
    //private Integer batteryNumber;
    private Integer n;

    /**
     * 版本 1-字节  0xAA
     */
    //private Integer version;
    private Integer v;

    /**
     * 电池数据
     */
   // private List<OneBattery> batteryData;
    private List<OneBattery> d;

    public BatteryDetail(Integer controlBoardAddress, Integer batteryNumber, Integer version, List<OneBattery> batteryData) {
        this.v = version;
        this.d = batteryData;
        this.n = batteryNumber;
        this.c = controlBoardAddress;
        if (batteryData != null) {
            this.d.sort(Comparator.comparing(OneBattery::getP));
        }
    }
}
